package listbyorder.access001_100.test58;

/**
 * @author code_yc
 * @version 1.0
 * @date 2020/6/2 8:55
 */
public class Solution1 {

    public int lengthOfLastWord(String s) {
        if (s == null || s.equals("")) return 0;
        String[] split = s.split(" ");
        for (int i = split.length - 1; i >= 0; i++) {
            if (!split[i].equals("")) {
                return split[i].length();
            }
        }
        return 0;
    }
}
